
<!--
/**************************************************
* @ orderauthorize.jsp
*
* Copyright   2005 Hitrust Technology Inc.
* Developed by SDC, Hitrust.
* All Rights Reserved.
*
* Modify History:
*  v1.00, 2006/02/12, Simonyi Peng
*  1) first release
*  v1.10, 2006/04/04, Jenny   Li
*  1) add button
/**************************************************
-->
<%@ page contentType="text/html; charset=UTF-8" %>
<%@ include file="../../common.jsp" %>
<%@ page import="java.util.StringTokenizer"%>
<%@ taglib uri="/page.util.gs.hitrust.com/taglibs/page" prefix="page"%>

<%@page import="system.LoginContext"%>
<%@page import="framework.core.SrvContext"%>
<html>
<head>
<title>订单审核</title>
<META http-equiv=Content-Type content="text/html; charset=UTF-8">
<LINK href="<%=root%>/css/caigouxitong.css" type=text/css rel=stylesheet>
<SCRIPT language="JavaScript" src="<%=root%>/js/common.js"></SCRIPT>
<SCRIPT language="JavaScript" src="<%=root%>/js/calendar.js"></SCRIPT>
<SCRIPT language="JavaScript" src="<%=root%>/js/string.js"></SCRIPT>

<%
ArrayList deptList = new ArrayList();
ArrayList addrList = new ArrayList();

ArrayList ary = (ArrayList)request.getAttribute("organdaddr");

	ArrayList tManuf1 = (ArrayList)request.getAttribute("manufacture1");
	HashMap tMap1 = (HashMap)request.getAttribute("manufacturetyp2");
	HashMap tMap2 = (HashMap)request.getAttribute("manufacturetyp3");


	GSOrderAuthorizeQueryVO oaqVO = (GSOrderAuthorizeQueryVO)session.getAttribute("QUERYCONDITION");
	ResultProcess tOrder = (ResultProcess)request.getAttribute("orderlist");
	ArrayList tList = new ArrayList();
	String[] tStr = null;
%>

<script>
	var counter;
	var allprovider = new Array();

	<%
		//在此作出成功提示
		if(request.getAttribute("SUCCESSMSG") != null)
			out.print("alert('"+request.getAttribute("SUCCESSMSG")+"');");
	%>
	function checkprovider(){
        var indexs = document.getElementsByName("indexs");
        for(var a=0;a<indexs.length;a++){
            if(indexs[a].checked){
                var chk=document.getElementById("provider"+a);
                var itms=chk.options;
                if(itms.length<=0){
                    alert('选择的记录中包含有无效供应商的订单明细，\n该明细不能提交或审核通过！');
                    return false;
                }
            }
        }
        return true;
    }
	
	function process(val){

		if(val == 'Q'){
			orderrauditform.action = "<%=response.encodeURL(root+"/A150202.do")%>";
    		orderrauditform.submit();			
		}else if(val == 'T'){
			var indexs = document.getElementsByName("indexs");
			var isSelected = false;
			for(i=0;i<indexs.length;i++){
				if(indexs[i].checked )
					isSelected = true;
			}
			if(isSelected != true) {
				alert("请至少选择一笔订单");
				return false;
			}
			//检测是否存在没有供应商情况
            if(checkprovider()==false){
                return false;
            }
			//检测必输字段是否全部输入
			if(!checkfull())
				return false;

			if(confirm("是否确定审核通过？")){						
				document.pager.action = "<%=response.encodeURL(root+"/A150204.do")%>";			
				document.all.confirmorreject.value='T';
                document.pager.method="post";
				document.pager.submit();
			}else{
				return false;
			}

		}else if(val == 'F'){
			var indexs = document.getElementsByName("indexs");
			var selectednum = 0;
			var orderids = new Array();
			for(i=0;i<indexs.length;i++){
				if(indexs[i].checked ){
					orderids[selectednum] = indexs[i].value;
					selectednum++;
				}
			}
			if(selectednum > 1) {
				alert("请至多选择一笔申购单");
				return false;
			}
			if(selectednum < 1) {
				alert("请至少选择一笔申购单");
				return false;
			}

			if(confirm("是否确定审核不通过？")){						
				goview("<%=response.encodeURL(root+"/A150203.do")%>?detailId="+orderids[0]);
			}

		}else if(val == 'TOA'){//直接提交
			var indexs = document.getElementsByName("indexs");
			var isSelected = false;
			for(i=0;i<indexs.length;i++){
				if(indexs[i].checked )
					isSelected = true;
			}
			if(isSelected != true) {
				alert("请至少选择一笔订单");
				return false;
			}
			//检测是否存在没有供应商情况
             if(checkprovider()==false){
                return false;
            }
			//检测必输字段是否全部输入
			if(!checkfull())
				return false;
				
			if(confirm("是否确定直接提交?")){
				document.pager.action = "<%=response.encodeURL(root+"/A150206.do")%>";	
                document.pager.method="post";		
				document.pager.submit();
			}else{
				return false;
			}
			
		}
	}
	
	function goview(url){
		//window.open(url,null," edge: sunken ; center: Yes; help: No; resizable: Yes; status: No; width: 960px ; height: 800px ; scrollbars:yes");
		var result = null;	
		result = showModalDialog(url, window,"status:no;unadorned:no;dialogWidth:900px;dialogHeight:1200px;help:no;srcollbars:yes");
		if(result != null){
			//process('Q');
			document.pager.action = "<%=response.encodeURL(root+"/A150204.do")%>";			
			document.all.auditcontent.value = result;
			document.all.confirmorreject.value='F';
            document.pager.method="post";
			document.pager.submit();			
		}
	}
	
	function checkfull(){
		var chkboxs = document.getElementsByName('indexs');
		for(i=0;i<chkboxs.length;i++){
			var curchkbox = document.getElementById('checkboxs'+i);
			if(curchkbox.checked){
				if(document.getElementById('ordercount'+i).value == null || Trim(document.getElementById('ordercount'+i).value) == ""){
					alert("请输入订货数量");return false;
				}
			}
		}
		return true;
	}
	
function change1(optval){
  var val = optval;
  if(val=='0'){
    var listbox = document.getElementById("manuftype2");
    listbox.length = 0;
    var option = new Option();
    option.text = "---二级---";
    option.value = "0";
    listbox.options[listbox.length] = option;
    change2(optval);
  }else{
      var counter="0";
    <%if(tMap1 !=null){
      Collection tCollection = tMap1.keySet();
      Iterator tIterator = tCollection.iterator();
      while(tIterator.hasNext()){
        String tKey = (String)tIterator.next();
        tList = (ArrayList)tMap1.get(tKey);%>
        if(val == '<%=tKey%>'){
		  counter = "1";
          var listbox = document.getElementById("manuftype2");
          listbox.length = 0;
          var option = new Option();
          option.value = "0";
          option.text = "---二级---";
          listbox.options[listbox.length] = option;
          <%
	          	for(int n=0;n<tList.size();n++){
		            GSManufactureCategoryBean tGSManufactureBean = (GSManufactureCategoryBean)tList.get(n);
		            String categoryId = tGSManufactureBean.getGs_manufacture_category_id();
		            String categoryName = tGSManufactureBean.getGs_manufacture_category_name();%>
		            var temp1 = '<%=categoryId%>';
		            var temp2 = '<%=categoryName%>';
		            var option = new Option();
		            option.value = temp1;
		            option.text = temp2;
		            listbox.options[listbox.length] = option;
           <%
	       		}
           %>
			change2('0');           
         }
         
    <%
    	}
    %>
    	if(counter == '0'){
          var listbox = document.getElementById("manuftype2");
          listbox.length = 0;
          var option = new Option();
          option.value = "0";
          option.text = "---二级---";
          listbox.options[listbox.length] = option;  
          change2('0');    	
    	}
    <%  
    }
    %>
   }
}
    function change2(optval){
      var val = optval;
      if(val=='0'){
        var listbox = document.getElementById("manuftype3");
        listbox.length = 0;
        var option = new Option();
        option.text = "---三级---";
        option.value = "0";
        listbox.options[listbox.length] = option;

      }else{
      	var counter = "0";
        <%if(tMap2 !=null){
          Collection tCollection = tMap2.keySet();
          Iterator tIterator = tCollection.iterator();
          while(tIterator.hasNext()){
            String tKey = (String)tIterator.next();
            tList = (ArrayList)tMap2.get(tKey);%>
            if(val == '<%=tKey%>'){
              counter = "1";
              var listbox = document.getElementById("manuftype3");
              listbox.length = 0;
              var option = new Option();
              option.text = "---三级---";
              option.value = "0";
              listbox.options[listbox.length] = option;
              <%for(int n=0;n<tList.size();n++){
                GSManufactureCategoryBean tGSManufactureBean = (GSManufactureCategoryBean)tList.get(n);
                String categoryId = tGSManufactureBean.getGs_manufacture_category_id();
                String categoryName = tGSManufactureBean.getGs_manufacture_category_name();%>
                var temp1 = '<%=categoryId%>';
                var temp2 = '<%=categoryName%>';
                var option = new Option();
                option.value = temp1;
                option.text = temp2;
                listbox.options[listbox.length] = option;
                <%}%>
              }
          <%
          }
          %>
          if(counter == '0'){
		        var listbox = document.getElementById("manuftype3");
		        listbox.length = 0;
		        var option = new Option();
		        option.text = "---三级---";
		        option.value = "0";
		        listbox.options[listbox.length] = option;          
          }
          <%
            }%>
          }
        }		

	function cls(){

		document.orderrauditform.orderDetailId.value = "";
		document.orderrauditform.providerName.value = "";
		document.orderrauditform.orderDept.options[0].selected = true;
		document.orderrauditform.concentricityId.value = "";
		document.orderrauditform.manufInfo.value = "";
		document.orderrauditform.orderCreateDateStr.value = "";
		document.orderrauditform.orderCreateDateEnd.value = "";
		document.orderrauditform.manuftype1.options[0].selected=true;
		document.orderrauditform.manuftype2.options[0].selected=true;
		document.orderrauditform.manuftype3.options[0].selected=true;
        document.orderrauditform.drawingpiececode.value = "";

		
	}
</script>
</head>



<body BGCOLOR="#f5f5f5"	text="#000000" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" onLoad="<%if("T".equals(request.getAttribute("ISQUERYCONDITIONEXIST"))){out.println("process('Q')");}%>">

<table width="98%" border="0" cellspacing="0" cellpadding="0" align="center">
  <tr>
    <td height="20"> 
      <table width="100%" border="0" cellspacing="0" cellpadding="1">
        <tr height="20">
          <td height="20" width="1" class="mtxt_black">&nbsp;</td>
          <td height="30" width="758" class="mtxt_black">订单审核</td>
        </tr>
      </table>
    </td>
  </tr>
  <tr>
    <td class="bg_line" height="2"></td>
  </tr>
</table>

<br>


<form name="orderrauditform" method="get" >
<table width="98%" border="0" cellspacing="0" cellpadding="0" align="center">
	<tr> 
		<td> 
			<table class=bg_table id=tableId	cellspacing=1 cellpadding=0 style="padding-left:5;padding-right:5" width=100% align=center border=0>
				<TR height=20>
					<TD class="bg_column" align=center>订单明细编号</TD>
					<TD align=left class="bg_row_odd">
					<input type="text" name="orderDetailId" maxlength="20" value="<%=oaqVO==null?"":oaqVO.orderDetailId%>">
					</TD>		
					<TD class="bg_column" align=center>供应商</TD>
					<TD align=left class="bg_row_odd">
					<input type="text" name="providerName" maxlength="20" value="<%=oaqVO==null?"":oaqVO.providerName%>">
					</TD>		
				</TR>
				<TR height=20>				
					<TD class="bg_column" align=center>订货单位</TD>
					<TD align=left class="bg_row_odd" colspan="3"">
				        <select id='orderDept' name='orderDept'>
                            <%String warehouseCode = oaqVO==null?"":oaqVO.deptId; %>
							<option value="<%=LoginContext.get(new SrvContext(request,response)).getLoginWarehouseCode() %>">---全部---</option><%
                              if(ary!=null&&ary.size()>0){
                                 for(int i=0;i<ary.size();i++){ 
                                     GSWareHouseBean tmp=(GSWareHouseBean)ary.get(i);%>
                                    <%if(tmp.getCode().equals(warehouseCode)){ %>
                                        <option value="<%=tmp.getCode() %>" selected><%=tmp.getName() %></option>
                                    <%}else{ %>
                                    <option value="<%=tmp.getCode() %>"><%=tmp.getName() %></option>
                            <%}}} %>         
                    	</select>
					</TD>
                     	
				</TR>
				<TR height=20>
					<TD class="bg_column" align=center>集中编码</TD>
					<TD align=left class="bg_row_odd" >
					<input type="text" name="concentricityId" maxlength="20" value="<%=oaqVO==null?"":oaqVO.concentricityId%>">
					</TD>
                    <td class="bg_column" align=center>图件号</td>
                    <td align=left class="bg_row_odd" >
                    <input type="text" name="drawingpiececode" value="<%=request.getParameter("drawingpiececode")==null?"":request.getParameter("drawingpiececode") %>">
                    </td>
				</TR>									
				<TR height=20>
					<TD class="bg_column" align=center>产品信息</TD>
					<TD align=left class="bg_row_odd" colspan="3">
					<input type="text" name="manufInfo" maxlength="200" value="<%=oaqVO==null?"":oaqVO.manufInfo %>">（<FONT color="#ff0033">对产品名称、型号、规格、品牌、生产厂商、附加属性等关键字的模糊查询</FONT>）&nbsp;
					</TD>
				</TR>									
				<TR height=20>							
					<TD class="bg_column" align=center>产品分类</TD>
					<TD align=left class="bg_row_odd" colspan="3">
				      <select name="manuftype1" onChange="change1(this.value)">
				        <option value="0">---一级---</option>
				        <%
				        String tManufType1 = request.getParameter("manuftype1");
				        if (tManuf1 != null && tManuf1.size() > 0) {
				          for (int i = 0; i < tManuf1.size(); i++) {
				            GSManufactureCategoryBean tGSManufactureBean = (GSManufactureCategoryBean) tManuf1.get(i);
				            if (tManufType1 != null && tManufType1.equals(tGSManufactureBean.getGs_manufacture_category_id())) {
				              %>
				              <option value="<%=tGSManufactureBean.getGs_manufacture_category_id()%>" selected><%=tGSManufactureBean.getGs_manufacture_category_name()%>        </option>
				              <%} else {      %>
				              <option value="<%=tGSManufactureBean.getGs_manufacture_category_id()%>"><%=tGSManufactureBean.getGs_manufacture_category_name()%>        </option>
				              <%
				              }
				            }
				          }
				          %>
				      </select>
				      <select id="manuftype2" name="manuftype2" onChange="change2(this.value)">
				        <option value="0">---二级---</option>
				        <%
				        String tManufType2 = request.getParameter("manuftype2");
				        if (tManufType1 != null && !tManufType1.equals("0")) {
				          ArrayList temp = (ArrayList) tMap1.get(tManufType1);
				          if (temp != null && temp.size() > 0) {
				            for (int i = 0; i < temp.size(); i++) {
				              GSManufactureCategoryBean tGSManuf2 = (GSManufactureCategoryBean) temp.get(i);
				              if (tManufType2 != null && tManufType2.equals(tGSManuf2.getGs_manufacture_category_id())) {
				                %>
				                <option value="<%=tManufType2%>" selected><%=tGSManuf2.getGs_manufacture_category_name()%>        </option>
				                <%} else {      %>
				                <option value="<%=tGSManuf2.getGs_manufacture_category_id()%>"><%=tGSManuf2.getGs_manufacture_category_name()%>        </option>
				                <%
				                }
				              }
				            }
				          }
				          %>
				      </select>
				      <select name="manuftype3" id="manuftype3">
				        <option value="0">---三级---</option>
				        <%
				        String tManufType3 = request.getParameter("manuftype3");
				        if (tManufType2 != null && !tManufType2.equals("0")) {
				          //int tIntManufType3 = Integer.parseInt(tManufType3);
				          ArrayList temp = (ArrayList) tMap2.get(tManufType2);
				          if (temp != null && temp.size() > 0) {
				            for (int i = 0; i < temp.size(); i++) {
				              GSManufactureCategoryBean tGSManuf3 = (GSManufactureCategoryBean) temp.get(i);
				              if (tManufType3 != null && tManufType3.equals(tGSManuf3.getGs_manufacture_category_id())) {
				                %>
				                <option value="<%=tGSManuf3.getGs_manufacture_category_id()%>" selected><%=tGSManuf3.getGs_manufacture_category_name()%>        </option>
				                <%} else {      %>
				                <option value="<%=tGSManuf3.getGs_manufacture_category_id()%>"><%=tGSManuf3.getGs_manufacture_category_name()%>        </option>
				                <%
				                }
				              }
				            }
				          }
				          %>
				      </select>					
					</TD>
				</TR>
                <%
                SimpleDateFormat bartDateFormat = new SimpleDateFormat("yyyy-MM-dd");
                Date d = new Date();
                String strNow = String.valueOf(bartDateFormat.format(d));
                long l=(long)259200*(long)10000;
                Date d2 = new Date(System.currentTimeMillis()-l);
                String strMothAgo = String.valueOf(bartDateFormat.format(d2));
                
                %>          	
				<TR height=20>	
					<TD class="bg_column" align=center>创建时间</TD>
					<TD align=left class="bg_row_odd" colspan="3">
					<%=framework.custom.UIManager.generateDateInput("orderCreateDateStr",
							request.getParameter("orderCreateDateStr")==null?strMothAgo:request.getParameter("orderCreateDateStr"))%>
					
					至
					<%=framework.custom.UIManager.generateDateInput("orderCreateDateEnd",
							request.getParameter("orderCreateDateEnd")==null?strNow:request.getParameter("orderCreateDateEnd"))%>
					
					
					</TD>
				</TR>	
			</table>
		</td>
	</tr>
    <tr>
            <%
            if(tOrder != null) {
                int totalRecords = 0;
                if(request.getAttribute("totalRecords")!=null){
                    totalRecords=Integer.parseInt((String)request.getAttribute("totalRecords"));
                }
                int defaultPageSize =10;
                if(request.getAttribute("pageSize")!=null){
                    defaultPageSize=Integer.parseInt((String)request.getAttribute("pageSize"));
                }
            %>          
            <page:pager total='<%=totalRecords%>' defaultPageSize='<%=defaultPageSize%>'></page:pager>
            <%} %>
    </tr>
</table>
</form>
    <p align="center">  
		<input type="button" class="kuang" value="查询" width="58" height="24" onclick="process('Q')"/>&nbsp;
		<input type="button" class="kuang" value="清空" width="58" height="24" onclick="cls()"/>&nbsp;
    </p>
<%

	if(tOrder != null){
%>
	<center>
    <table width="98%" border="0" cellspacing="0" cellpadding="0" align="center">
		<tr>
			<td>
            <form name='pager' method="post">
			<input type="hidden" name='confirmorreject'>
            <input type='hidden' name='auditcontent' >
            	<table class=bg_table id=tableId	cellspacing=1 cellpadding=2 width=100% align=center border=0>
                    <tbody> 
                    <tr class="bg_column" height=20> 
                    	<td align=center class=top>
						<div class="txt_content"><input type="checkbox" name="ckbox" onClick="SelectAllCheckBox()"></div>
						</td> 
                        <td class=top align=center > 
                        <div align="center" class="txt_content">订单明细编号</div>
						</td>
                        <td class=top align=center > 
                        <div align="center" class="txt_content">集中编码</div>
						</td>
                        <td class=top align=center > 
                        <div align="center" class="txt_content">产品名称</div>
						</td>
                        <td class=top align=center > 
                        <div align="center" class="txt_content">规格</div>
						</td>
                        <td class=top align=center > 
                        <div align="center" class="txt_content">型号</div>
						</td>
                        <td class=top align=center > 
                        <div align="center" class="txt_content">品牌</div>
						</td>
                        <td class=top align=center > 
                        <div align="center" class="txt_content">图件号</div>
                        </td>
                        <td class=top align=center > 
                        <div align="center" class="txt_content">订货单位</div>
						</td>
                        <td class=top align=center > 
                        <div align="center" class="txt_content">产品类型</div>
						</td>
                        <td class=top align=center > 
                        <div align="center" class="txt_content">供应商</div>
						</td>
                        <td class=top align=center > 
                        <div align="center" class="txt_content">订货数量</div>
						</td>
                        <td class=top align=center > 
                        <div align="center" class="txt_content">单价</div>
						</td>
                        <td class=top align=center > 
                        <div align="center" class="txt_content">总价</div>
						</td>
                        <td class=top align=center > 
                        <div align="center" class="txt_content">送货日期</div>
						</td>
                        <td class=top align=center > 
                        <div align="center" class="txt_content">送货时间</div>
						</td>
                        <td class=top align=center > 
                        <div align="center" class="txt_content">结算模式</div>
                        </td>
						<td class=top align=center > 
                        <div align="center" class="txt_content">详细信息</div>
						</td>
					</tr>
					<%
						tList = tOrder.getAllRecoreds();

						if(tList != null && tList.size() > 0){
						for(int i=0; i<tList.size(); i++){
							GSOrderAuthorizeVO tGSOrderVO = (GSOrderAuthorizeVO)tList.get(i);
							String tTempStr="";
							if(i%2==0){
								tTempStr="class=\"bg_row_odd\"";
							}else {
								tTempStr="class=\"bg_row_even\"";
							}

							//初始化供应商
					%> 
							<script language='javascript'>
							    var providerlist<%=i%> = new Array();
							    
					<%
							for(int j=0;j<tGSOrderVO.providerList.size();j++){
								GSProviderWithPriceVO tmp = (GSProviderWithPriceVO)tGSOrderVO.providerList.get(j);
								
					%>
								var v<%=i%><%=j%> = new Array();
								v<%=i%><%=j%>[0] = "<%=tmp.bean.getGs_provider_id()%>";
								v<%=i%><%=j%>[1] = "<%=tmp.manufactureId%>";
								v<%=i%><%=j%>[2] = "<%=tmp.unitPrice%>";
								v<%=i%><%=j%>[3] = "<%=tmp.isTradeFlatManuf%>";
								v<%=i%><%=j%>[4] = "<%=tmp.isTradeFlatProvider%>";								
								v<%=i%><%=j%>[5] = "<%=tmp.mode%>";
								providerlist<%=i%>[<%=j%>] = v<%=i%><%=j%>;
					<%
							}
					%>
								allprovider[<%=i%>] = providerlist<%=i%>;
							</script>
							<tr <%=tTempStr%> height=20>
								<td class=top align=center > 
									<div align="center" class="txt_content">
									<input type="checkbox" id='checkboxs<%=i%>' name="indexs" value="<%=tGSOrderVO.detailId%>" >
									</div>
								</td>			
								<!--订单明细编号-->
								<td class=top align=center  > 								
									<div align="center" class="txt_content">
									<%=tGSOrderVO.detailId%>
									<input type='hidden' name='detailId' value='<%=tGSOrderVO.detailId%>'>
									<input type='hidden' name='orderId' value='<%=tGSOrderVO.orderId%>'>
									</div>
								</td>	
								<!--集中编码-->							
								<td class=top align=center > 
									<div align="center" class="txt_content">
									<%=tGSOrderVO.concentricityId%>
									<input type='hidden' name='concentricityid' value='<%=tGSOrderVO.concentricityId%>'>
									<input type='hidden' id='manufactureid<%=i%>' name='manufactureId' value='<%=tGSOrderVO.manufactureId%>'>
									<input type='hidden' name='oldManufactureId' value='<%=tGSOrderVO.manufactureId%>'>
									</div>
								</td>
								<!--产品名称-->
								<td class=top align=center > 
									<div align="center" class="txt_content">
									<a href="<%=response.encodeURL(root+"/A150103.do")%>?concentricityId=<%=tGSOrderVO.concentricityId%>" target="_blank"><%=tGSOrderVO.manufactureName%></a>
									</div>
								</td>	
								<!--规格-->			
								<td class=top align=center > 
									<div align="center" class="txt_content">
									<%=tGSOrderVO.manufactureSpec==null?"":tGSOrderVO.manufactureSpec%>
									</div>
								</td>	
								<!--型号-->			
								<td class=top align=center > 
									<div align="center" class="txt_content">
									<%=tGSOrderVO.manufactureType==null?"":tGSOrderVO.manufactureType%>
									</div>
								</td>	
								<!--品牌-->			
								<td class=top align=center > 
									<div align="center" class="txt_content">
									<%=tGSOrderVO.manufactureBrand==null?"":tGSOrderVO.manufactureBrand%>
									</div>
								</td>
                                <!--图件号-->           
                                <td class=top align=center > 
                                    <div align="center" class="txt_content">
                                    <%=tGSOrderVO.drawingpiececode==null?"":tGSOrderVO.drawingpiececode%>
                                    </div>
                                </td>   	
								<!--订货单位-->			
								<td class=top align=center > 
									<div align="center" class="txt_content">
									<%=tGSOrderVO.deptName%>
									</div>
								</td>	
								<!--是否网上产品-->			
								<td class=top align=center > 							
									<div align="center" class="txt_content" id="isManuf<%=i%>"><%=GSBaseManager.getProductTypeByCode(tGSOrderVO.is_normal)%></div><input type="hidden" id="isTradeFlatManuf<%=i%>" name="isTradeFlatManuf" value="<%=tGSOrderVO.isTradeFlatManufacture%>">
                                    <input type="hidden" id="isTradeFlatProvider<%=i%>" name="isTradeFlatProvider" value="<%=tGSOrderVO.isTradFlatProvider%>">
								</td>	
								<!--供应商-->				
								<%
									double price4CurrentProvider = 0.00;
									boolean isTradeFlatExist = false;
								%>
								<td class=top align=center > 
									<div align="center" class="txt_content">
										<input type='hidden' name="oldProviderId" value="<%=tGSOrderVO.providerId%>">
                                        <input type='hidden' name="newProviderId" id="newprovider<%=i %>" value="<%=tGSOrderVO.providerId%>">
										<select id='provider<%=i%>' name='providerId' onchange='changeprovider(<%=i%>)'>
										<%
										
											if(tGSOrderVO.providerList != null){
											for(int j = 0;j<tGSOrderVO.providerList.size();j++){
												GSProviderWithPriceVO tmp = (GSProviderWithPriceVO)tGSOrderVO.providerList.get(j);
										%>
												<option value='<%=tmp.bean.getGs_provider_id()%>' 
												<%
												//if(Double.parseDouble(tmp.unitPrice) < price4CurrentProvider){
												//	price4CurrentProvider = Double.parseDouble(tmp.unitPrice);
												//	if(!isTradeFlatExist ){
												//		out.print("selected");
												//		if("0".equals(tmp.isTradeFlatManuf) && "0".equals(tmp.bean.getGs_is_tradeflat_provider())){
												//			isTradeFlatExist = true;
												//		}
												//	}
												//}
												if(tGSOrderVO.providerId.equals(tmp.bean.getGs_provider_id())){
													out.print(" selected");
													price4CurrentProvider = Double.parseDouble(tmp.unitPrice);
												}
												%>
												>
												<%if("0".equals(tmp.isTradeFlatManuf) && "0".equals(tmp.bean.getGs_is_tradeflat_provider())){%>
												<%=tmp.bean.getGs_provider_shortname()+"(采购网配送)"%>
												<%}else{%>
												<%=tmp.bean.getGs_provider_shortname()%>
												<%}%>
												</option>
										<%
											}
											}
											
										%>
										</select>
									</div>
								</td>																																		
								<!--订货数量-->			
								<td class=top align=center  > 
									<div align="center" class="txt_content" >
									<input type='hidden' name='oldOrderCount' value='<%=tGSOrderVO.orderCount%>' >
									<input type='text' id='ordercount<%=i%>' name='orderCount' size='8' value='<%=StringUtils.formatEDouble(tGSOrderVO.orderCount,2)%>' onblur='changeprice(<%=i%>)'><%=tGSOrderVO.quantUnit%>
									</div>
								</td>	
								<!--单价-->

								<td class=top align=center> 
									<div align="center" class="txt_content"  id='unitprice_<%=i%>'><%=StringUtils.format(price4CurrentProvider,4)%>元</div><input type='hidden' id='unitprice<%=i%>' name='unitPrice' value='<%=price4CurrentProvider%>'><input type='hidden' name='oldUnitPrice' value='<%=price4CurrentProvider%>'>
								</td>
								<!--总价-->			
								<td class=top align=center  id='totalprice_<%=i%>'> 
									<div align="center" class="txt_content" >
									<%=StringUtils.format(tGSOrderVO.totalPrice,4)%>元
									</div>
								</td>
								<!--送货日期-->							
								<td class=top align=center > 
									<div align="center" class="txt_content">
									<input type="text" id='deliverDate<%=i%>' name='deliverDate' size="10" value='<%=tGSOrderVO.deliverDate%>' readonly onfocus='setday(this)' onKeyDown="keydown2('deliverTime<%=i%>')">
									<!--<%=tGSOrderVO.deliverDate%>-->
									</div>
								</td>	
								<!--送货时间-->														
								<td class=top align=center > 
									<div align="center" class="txt_content">
									<select id='deliverTime<%=i%>' name='deliverTime'>
                            			<option value='1' <%="1".equals(tGSOrderVO.deliverTime) ? "selected" : ""%>>8:00-12:00</option>
                            			<option value='2' <%="2".equals(tGSOrderVO.deliverTime) ? "selected" : ""%>>13:00-18:00</option>
                            			<option value='3' <%="3".equals(tGSOrderVO.deliverTime) ? "selected" : ""%>>全天</option>
                            		</select>
									<!--<%=GSBaseManager.getDeliverGoodsTime(tGSOrderVO.deliverTime)%>-->
									</div>
								</td>	
                                <!--结算模式-->                         
                                <td class=top align=center > 
                                    <div align="center" class="txt_content" id="divmode<%=i %>">
                                    <%=DefineDic.getBalanceMode(tGSOrderVO.mode) %>
                                    </div><input type="hidden" id='mode<%=i%>' name='mode' value='<%=tGSOrderVO.mode%>'>
                                    <input type="hidden"  name='oldmode' value='<%=tGSOrderVO.mode%>'>
                                </td>
								<!--详细-->														
								<td class=top align=center > 
									<div align="center" class="txt_content">
									<a href="<%=response.encodeURL(root+"/A150505.do")%>?orderId=<%=tGSOrderVO.orderId%>&orderDetailId=<%=tGSOrderVO.detailId%>" target="_blank">详细</a>
									</div>
								</td>	
							</tr> 
						
							
					<%	
						}
					%>
						  <tr class="bg_column" height=20>
						    <td width="960" height="16" colspan="18" align="right">
									<!--导航条-->
						    		<page:navigator type='text' queryForm='orderrauditform'/>
						    </td>
						  </tr>
				    <%
						}else{
					%>
                            <tr class="bg_column" height=20>
                            <td width="960" height="16" colspan="19" align="center"
                               ><font color="red">没有符合条件的订单明细信息,请重新输入查询条件</font></td>
                            </tr>
					<%
						}
					%>
					</tbody>
				</table>
				</form>					  
			</td>
		</tr>
	</table>
	</center>
	<p align="center">  
    	<input type="button" class="kuang" name="提交" value="审核通过" onclick="process('T')">
    	<input type="button" class="kuang" name="驳回" value="审核不通过" onclick="process('F')">
    	<input type="button" class="kuang" name="直接提交" value="直接提交" onclick="process('TOA')">    	
    </p>
	
<%		
	}
	if(tOrder == null && request.getAttribute("ISQUERYCONDITIONEXIST") != null && request.getAttribute("ISQUERYCONDITIONEXIST").equals("T")){
%>
		<font size="2">数据查询中......</font>
<%
	}
%>

</body>
<script language='javascript'>
	function changeprovider(num){
		var providerbuffer = allprovider[num];
		var providerid = document.getElementById("provider"+num).value;
        document.getElementById("newprovider"+num).value=providerid;
		var options = document.getElementById("provider"+num).options;
		var selected = 0;
		for(i=0;i<options.length;i++){
			if(options[i].selected == true){
				selected = i;
			}
		}
		for(i=0;i<providerbuffer.length;i++){
			var buff = providerbuffer[i];
			
			if(buff[0] == providerid && i == selected){
				document.getElementById("manufactureid"+num).value = buff[1];
				document.getElementById("unitprice_"+num).innerText = buff[2]+"元";
				document.getElementById("unitprice"+num).value=buff[2];
				document.getElementById("isTradeFlatManuf" + num).value=buff[3];
                var s="";
                if(Trim(buff[3])=='1'){
                    s = "网上产品";
                }
                if(Trim(buff[3])=='2') {
                    s = "非网上产品";
                }
                if (Trim(buff[3])=='0') {
                    s = "网上特约产品";
                }
                document.getElementById("isManuf"+num).innerText=s;
				document.getElementById("isTradeFlatProvider" + num).value=buff[4];
                document.getElementById("mode" + num).value=buff[5];
                if(buff[5]=='<%=GSBaseConstants.BALANCE_MODE1%>'){
                    document.getElementById("divmode" + num).innerText='<%=DefineDic.getBalanceMode(GSBaseConstants.BALANCE_MODE1)%>';
                }else{
                    document.getElementById("divmode" + num).innerText='<%=DefineDic.getBalanceMode(GSBaseConstants.BALANCE_MODE2)%>';
                }
				changeprice(num);
			}
		}
		
	}
	
	function changeprice(num)
	{
		if (isNaN(document.getElementById("ordercount"+num).value))
		{
			alert("数量必须是有效的数字！");
			document.getElementById("ordercount"+num).value = "";
			return false;
		}
		var orderCount = parseFloat(document.getElementById("ordercount"+num).value);
		if(orderCount <= 0){
			alert("禁止输入负数和零！");
			document.getElementById("ordercount"+num).value = "";
			return false;
		}
		var unitPrice = parseFloat(document.getElementById("unitprice"+num).value);
		totalPrice = Math.round(orderCount * unitPrice * 10000)/10000;

		document.getElementById("totalprice_"+num).innerHTML = "<div align='center' class='txt_content'>"+ totalPrice +"元</div>";
		
	}
	
	function SelectAllCheckBox(){ 
	  if (document.all.indexs != null){ 
	    var OnOff = document.all.ckbox.checked; 
	    var theItem = document.getElementsByName("indexs"); 
	    if (theItem!=null){ 
	      if (typeof(theItem.value)=='undefined'){ 
	        var i; 
	        for (i=0;i < theItem.length; i++){ 
	          var SubItem = theItem[i]; 
	          SubItem.checked = OnOff; 
	        } 
	      }else{ 
	        theItem.checked = OnOff; 
	      } 
	    } 
	  }     
    }
    
</script>
</html>